/*
Replication code for:
"Payday and Public Opinion toward Taxation: Understanding how Being Paid Affects Support for Tax Cuts"

Author: Tobias Heide-Jørgensen.

Purpose: Reproducing empirical results.

Required Stata packages: rdrobust (ssc install rdrobust), coefplot (ssc install coefplot), estout (ssc install estout), and rddisttestk (install from https://economics.byu.edu/faculty-and-staff/frandsen/software and put into ado plus folder (type sysdir to find the directory)).
*/

***MAIN ANALYSES***

*Read data
use "Main_data.dta",clear

*Figure 1
gen mdy=mdy(month,day,year) //Date variable in date format

hist mdy if survey==1, discrete freq color(%20) width(1) title("DNES 2001/2002", margin(b=5) size(large)) xlabel(15337 "Dec-28" 15371 "Jan-31" 15399 "Feb-28") xscale(r(15326 15411)) addplot(pci 0 15337 50 15337 0 15371 50 15371 0 15399 50 15399, lwidth(medium) color(black)) xtitle("") legend(off) plotregion(lcolor(white)) ylab(0 25 50,angle(h)) ytitle("") yscale(titlegap(3.2)) scheme(s1mono) graphregion(color(white)) saving(hist_dnes01, replace)

hist mdy if survey==2, discrete freq color(%20) width(1) title("DNES 2007/2008", margin(b=5) size(large)) xlabel(17528 "Dec-28" 17562 "Jan-31" 17591 "Feb-29" 17622 "Mar-31") xscale(r(17521 17634)) addplot(pci 0 17528 800 17528 0 17562 800 17562 0 17591 800 17591 0 17622 800 17622, lwidth(medium) color(black)) ylab(0 400 800,angle(h)) ytitle("") xtitle("") legend(off) plotregion(lcolor(white)) scheme(s1mono) graphregion(color(white)) saving(hist_dnes07, replace)

hist mdy if survey==3, discrete freq color(%20) width(1) title("DNES 2015", margin(b=5) size(large)) xlabel(20269 "Jun-30" 20300 "Jul-31" 20331 "Aug-31" 20361 "Sep-30") xscale(r(20257 20373)) addplot(pci 0 20269 70 20269 0 20300 70 20300 0 20331 70 20331 0 20361 70 20361, lwidth(medium) color(black)) ylab(0 35 70,angle(h)) ytitle("") xtitle("") yscale(titlegap(3.2)) legend(off) plotregion(lcolor(white)) scheme(s1mono) graphregion(color(white)) saving(hist_dnes15, replace)

gr combine hist_dnes01.gph hist_dnes07.gph hist_dnes15.gph, col(1) graphregion(color(white)) 

*Figure 2
hist run, discrete freq color(%20) width(1) title("") xscale(r(-8 8)) legend(off) plotregion(lcolor(white)) ytitle(,height(6)) scheme(s1mono) graphregion(color(white)) xlab(-7 (1) 7) ylab(0 500 1000,angle(h)) ytitle("") xtitle(Days before and after payday,height(6))

*Figure 3
rdplot tax run,h(7) p(2) ci(95) shade vce(cluster date_num)  graph_options(xlabel(-7(1)7)  xtitle("Days before and after payday",height(6)) ylabel(, format(%03.1f) angle(h)) xscale(r(0.2 0.6)) plotregion(lcolor(white)) scheme(s1mono) graphregion(color(white)) ytitle("Probability of supporting tax cuts", height(6)) legend(off))

*Table 1/Table C.1 (Supplementary Material)
qui: eststo m1: reg tax payday run c.run#c.run payday#c.run payday#c.run#c.run,cluster(date)
estadd local band "7 days", replace	
										
qui: eststo m2: reg tax payday run c.run#c.run payday#c.run payday#c.run#c.run c.age##c.age male i.edu i.occu i.inc,cluster(date)
estadd local band "7 days", replace
						
qui: eststo m3: reg tax payday run c.run#c.run payday#c.run payday#c.run#c.run c.age##c.age male i.edu i.occu i.inc i.survey,cluster(date)
estadd local band "7 days", replace

qui: eststo m4: reg tax payday run c.run#c.run payday#c.run payday#c.run#c.run c.age##c.age male i.edu i.occu i.inc i.survey i.month,cluster(date)
estadd local band "7 days", replace							

qui: eststo m5: reg tax payday run c.run#c.run payday#c.run payday#c.run#c.run c.age##c.age male i.edu i.occu i.inc i.survey i.month weekholi,cluster(date)
estadd local band "7 days", replace							

qui: eststo m6: reg tax payday run c.age##c.age male i.edu i.occu i.inc i.survey i.month weekholi if inrange(run,-1,1),cluster(date) 
estadd local band "1 day", replace							

esttab m1 m2 m3 m4 m5 m6, cells("b(fmt(2))" se(par(`"("' `")"') fmt(2)) p(par(`"["' `"]"') fmt(3))) stats(band N, fmt(%9.0fc) label("Bandwidth" "Observations")) keep(payday run c.run#c.run 1.payday#c.run 1.payday#c.run#c.run age c.age#c.age male 2.edu 3.edu 4.edu 5.edu 99.edu 2.occu 3.occu 4.occu 2.inc 3.inc 4.inc 5.inc 6.inc 7.inc 8.inc 9.inc 10.inc 11.inc 12.inc 13.inc 99.inc 2.survey 3.survey 2.month 3.month 4.month 5.month 6.month 7.month 8.month 9.month 10.month 12.month weekholi _cons) order(payday run c.run#c.run 1.payday#c.run 1.payday#c.run#c.run age c.age#c.age male 2.edu 3.edu 4.edu 5.edu 99.edu 2.occu 3.occu 4.occu 2.inc 3.inc 4.inc 5.inc 6.inc 7.inc 8.inc 9.inc 10.inc 11.inc 12.inc 13.inc 99.inc 2.survey 3.survey 2.month 3.month 4.month 5.month 6.month 7.month 8.month 9.month 10.month 12.month weekholi _cons) label

*Figure 4
foreach num of numlist 4/7 {
reg tax payday##c.run##c.run if inrange(run,-`num',`num'),cluster(date) 
estimate store sim_`num' 							

reg tax payday##c.run##c.run c.age##c.age male i.edu i.occu i.inc i.survey i.month weekholi if inrange(run,-`num',`num'),cluster(date) 
estimate store full_`num'							
}

foreach num of numlist 1/3 {
reg tax payday##c.run if inrange(run,-`num',`num'),cluster(date) 
estimate store sim_`num' 							

reg tax payday##c.run c.age##c.age male i.edu i.occu i.inc i.survey i.month weekholi if inrange(run,-`num',`num'),cluster(date) 
estimate store full_`num'							
}

coefplot sim_7 full_7, bylabel("7 days") || sim_6 full_6, bylabel("6 days") || sim_5 full_5, bylabel("5 days") || sim_4 full_4, bylabel("4 days") || sim_3 full_3, bylabel("3 days") || sim_2 full_2, bylabel("2 days") || sim_1 full_1, bylabel("1 day") keep(1.payday)  vertical yline(0, lpattern(dash)) bycoefs byopts(yrescale color(grey)) ylabel(-0.1 "-0.1" 0 "0" 0.1 "0.1" 0.2 "0.2" 0.3 "0.3", angle(h)) p1(label(Simple model)) p2(label(Full model)) ciopts(recast(rcap) color(black)) plotregion(lcolor(white)) mcolor(gs0) scheme(s1mono) graphregion(color(white)) ytitle(Probability of supporting tax cuts, height(6)) xtitle(Bandwidth, height(6)) legend(pos(4) col(1) region(lstyle(none))  linegap(3) size(small) symxsize(*0.2)) title("")

*Figure 5
use "Placebo_data.dta",clear //read placebo data

foreach num of numlist 4/7 {
reg tax payday##c.run##c.run if inrange(run,-`num',`num'),cluster(date) 
estimate store sim_`num' 							

reg tax payday##c.run##c.run c.age##c.age male i.edu i.occu i.inc i.survey i.month weekholi if inrange(run,-`num',`num'),cluster(date) 
estimate store full_`num'							
}

foreach num of numlist 1/3 {
reg tax payday##c.run if inrange(run,-`num',`num'),cluster(date) 
estimate store sim_`num' 							

reg tax payday##c.run c.age##c.age male i.edu i.occu i.inc i.survey i.month weekholi if inrange(run,-`num',`num'),cluster(date) 
estimate store full_`num'							
}

coefplot sim_7 full_7, bylabel("7 days") || sim_6 full_6, bylabel("6 days") || sim_5 full_5, bylabel("5 days") || sim_4 full_4, bylabel("4 days") || sim_3 full_3, bylabel("3 days") || sim_2 full_2, bylabel("2 days") || sim_1 full_1, bylabel("1 day") keep(1.payday)  vertical yline(0, lpattern(dash)) bycoefs byopts(yrescale color(grey)) ciopts(recast(rcap) color(black)) ylabel(-1 "-1" -.5 "-0.5" 0 "0" .5 "0.5", angle(h)) p1(label(Simple model)) p2(label(Full model)) plotregion(lcolor(white)) mcolor(gs0) scheme(s1mono) graphregion(color(white)) ytitle(Probability of supporting tax cuts, height(6)) xtitle(Bandwidth, height(6)) legend(pos(4) col(1) region(lstyle(none))  linegap(3) size(small) symxsize(*0.2)) title("")

*Figure 6
use "Main_data.dta",clear //reload main data

reg inc_mis payday if inlist(run,-1,0) //test for difference between day before payday and payday
eststo inc_mis_before_payday: margins, at(payday=0) post
reg inc_mis payday if inlist(run,-1,0)
eststo inc_mis_payday: margins, at(payday=1) post

gen lab="7.1%" if payday==0
replace lab="4.2%" if payday==1

bysort payday: keep if _n==_N

coefplot (inc_mis_before_payday,label(Day before payday) color(gs5) ciopts(recast(rcap) color(black))) (inc_mis_payday,label(Payday) color(gs10) ciopts(recast(rcap) color(black))),vertical legend(pos(4) col(1) region(lstyle(none))  linegap(3) size(small) symxsize(*0.2)) recast(bar) xlabel("") xtitle("") barwidth(0.3) level(95) ylabel(0 "0%" .05 "5%" .1 "10%", angle(h)) citop scheme(s1mono) barwidth(0.2) graphregion(color(white)) plotregion(lcolor(white) margin(b=0)) format(%9.2f) ytitle(% not reporting an income,height(6)) addplot(scatter @b @at, ms(i) mlabel(lab) mlabpos(2) mlabcolor(black))	

*Figure 7
use "Main_data.dta",clear //reload data

*7-days bandwidth
foreach num of numlist 0/1 {
reg tax payday c.run##c.run payday#c.run payday#c.run#c.run c.age##c.age male i.inc i.occu i.survey i.month weekholi if high_edu==`num',cluster(date)
estimate store edu`num'_7
}

*test of significant differences in effect
foreach num of numlist 0/1 {
qui: reg tax payday c.run##c.run payday#c.run payday#c.run#c.run c.age##c.age male i.inc i.occu i.survey i.month weekholi if high_edu==`num'
estimate store edu`num'_7_test
}
	
qui: suest edu0_7_test edu1_7_test,cluster(date)
test [edu0_7_test_mean]payday=[edu1_7_test_mean]payday //comparing low- and high-educated
return list

*1-day bandwidth
foreach num of numlist 0/1 {
reg tax payday run c.age##c.age male i.inc i.occu i.survey i.month weekholi if inrange(run,-1,1) & high_edu==`num',cluster(date)
estimate store edu`num'_1
}

*test of significant differences in effect
foreach num of numlist 0/1 {
qui: reg tax payday run c.age##c.age male i.inc i.occu i.survey i.month weekholi if inrange(run,-1,1) & high_edu==`num'
estimate store edu`num'_1_test
}
	
qui: suest edu0_1_test edu1_1_test,cluster(date)
test [edu0_1_test_mean]payday=[edu1_1_test_mean]payday //comparing low- and high-educated
return list

coefplot edu0_7 edu1_7, bylabel("7 days") || edu0_1 edu1_1, bylabel("1 day") keep(payday) ciopts(recast(rcap) color(black)) vertical yline(0, lpattern(dash)) bycoefs byopts(yrescale color(grey)) ylabel(0 "0" .1 "0.1" .2 "0.2" .3 "0.3" .4 "0.4", angle(h)) p1(label(No higher education)) p2(label(Completed higher education)) plotregion(lcolor(white)) mcolor(gs0) scheme(s1mono) graphregion(color(white)) ytitle(Probability of supporting tax cuts,height(6)) xtitle(Bandwidth, height(6)) legend(pos(4) col(1) region(lstyle(none))  linegap(3) size(small) symxsize(*0.2)) title("") 

*Figure 8
*7-days bandwidth
foreach num of numlist 1/3 {
reg tax payday c.run##c.run payday#c.run payday#c.run#c.run c.age##c.age male i.edu i.occu i.survey i.month weekholi if inc_3==`num',cluster(date)
estimate store inc_`num'_7	
}
					
*test of significant differences in effect
foreach num of numlist 1/3 {
qui: reg tax payday c.run##c.run payday#c.run payday#c.run#c.run c.age##c.age male i.edu i.occu i.survey i.month weekholi if inc_3==`num'
estimate store inc_`num'_7_test							
}

qui: suest inc_1_7_test inc_2_7_test inc_3_7_test,cluster(date)	
test [inc_1_7_test_mean]payday=[inc_2_7_test_mean]payday //comparing low and middle income
return list
test [inc_1_7_test_mean]payday=[inc_3_7_test_mean]payday //comparing low and high income
return list
test [inc_2_7_test_mean]payday=[inc_3_7_test_mean]payday //comparing middle and high income
return list
	
test [inc_1_7_test_mean]payday=[inc_2_7_test_mean]payday=[inc_3_7_test_mean]payday //joint test of equal effect
return list

*1 day bandwidth
foreach num of numlist 1/3 {
reg tax payday run c.age##c.age male i.edu i.occu i.survey i.month weekholi if inrange(run,-1,1) & inc_3==`num',cluster(date)
estimate store inc_`num'_1
}	

*test of significant differences in effect
foreach num of numlist 1/3 {
qui: reg tax payday run c.age##c.age male i.edu i.occu i.survey i.month weekholi if inrange(run,-1,1) & inc_3==`num'
estimate store inc_`num'_1_test						
}

qui: suest inc_1_1_test inc_2_1_test inc_3_1_test,cluster(date)
test [inc_1_1_test_mean]payday=[inc_2_1_test_mean]payday //comparing low and middle income
return list
test [inc_1_1_test_mean]payday=[inc_3_1_test_mean]payday //comparing low and high income
return list
test [inc_2_1_test_mean]payday=[inc_3_1_test_mean]payday //comparing middle and high income
return list
	
test [inc_1_1_test_mean]payday=[inc_2_1_test_mean]payday=[inc_3_1_test_mean]payday //joint test of equal effect
return list
	
coefplot inc_1_7 inc_2_7 inc_3_7, bylabel("7 days") || inc_1_1 inc_2_1 inc_3_1, bylabel("1 day") keep(payday)  vertical yline(0, lpattern(dash)) ciopts(recast(rcap) color(black)) bycoefs byopts(yrescale color(grey)) ylabel(-.2 "-0.2" 0 "0" .2 "0.2" .4 "0.4" .6 "0.6", angle(h)) p1(label(Low income)) p2(label(Middle income)) p3(label(High income)) plotregion(lcolor(white)) mcolor(gs0) scheme(s1mono) graphregion(color(white)) ytitle(Probability of supporting tax cuts, height(6)) xtitle(Bandwidth, height(6)) legend(pos(4) col(1) region(lstyle(none))  linegap(3) size(small) symxsize(*0.2)) title("")

*Figure 9
*7-days bandwidth
foreach num of numlist 1/3 {
reg tax payday c.run##c.run payday#c.run payday#c.run#c.run c.age##c.age male i.edu i.occu i.inc i.survey i.month weekholi if ideo_group==`num',cluster(date)
estimate store ideo_`num'_7	
}
				
*test of significant differences in effect
foreach num of numlist 1/3 {
qui: reg tax payday c.run##c.run payday#c.run payday#c.run#c.run c.age##c.age male i.edu i.occu i.inc i.survey i.month weekholi if ideo_group==`num'
estimate store ideo_`num'_7_test							
}		

qui: suest ideo_1_7_test ideo_2_7_test ideo_3_7_test,cluster(date)
test [ideo_1_7_test_mean]payday=[ideo_2_7_test_mean]payday //comparing leftists and centrists
return list
test [ideo_1_7_test_mean]payday=[ideo_3_7_test_mean]payday //comparing leftists and rightists
return list
test [ideo_2_7_test_mean]payday=[ideo_3_7_test_mean]payday //comparing centrists and rightists
return list
	
test [ideo_1_7_test_mean]payday=[ideo_2_7_test_mean]payday=[ideo_3_7_test_mean]payday //joint test of equal effect
return list

*1-day bandwidth
foreach num of numlist 1/3 {
reg tax payday run c.age##c.age male i.edu i.occu i.inc i.survey i.month weekholi if inrange(run,-1,1) & ideo_group==`num',cluster(date)
estimate store ideo_`num'_1							
}

*test of significant differences in effect
foreach num of numlist 1/3 {
qui: reg tax payday run c.age##c.age male i.edu i.occu i.inc i.survey i.month weekholi if inrange(run,-1,1) & ideo_group==`num'
estimate store ideo_`num'_1_test						
}

qui: suest ideo_1_1_test ideo_2_1_test ideo_3_1_test,cluster(date)
test [ideo_1_1_test_mean]payday=[ideo_2_1_test_mean]payday //comparing leftists and centrists
return list
test [ideo_1_1_test_mean]payday=[ideo_3_1_test_mean]payday //comparing leftists and rightists
return list
test [ideo_2_1_test_mean]payday=[ideo_3_1_test_mean]payday //comparing centrists and rightists
return list
	
test [ideo_1_1_test_mean]payday=[ideo_2_1_test_mean]payday=[ideo_3_1_test_mean]payday //joint test of equal effect
return list
					
coefplot ideo_1_7 ideo_2_7 ideo_3_7, bylabel("7 days") || ideo_1_1 ideo_2_1 ideo_3_1, bylabel("1 day") keep(payday)  vertical yline(0, lpattern(dash)) ciopts(recast(rcap) color(black)) bycoefs byopts(yrescale color(grey)) ylabel(-.6 "-0.6" -.4 "-0.4" -.2 "-0.2" 0 "0" .2 "0.2" .4 "0.4", angle(h)) p1(label(Left-wing)) p2(label(Centrist)) p3(label(Right-wing)) plotregion(lcolor(white)) mcolor(gs0) scheme(s1mono) graphregion(color(white)) ytitle(Probability of supporting tax cuts, height(6)) xtitle(Bandwidth, height(6)) legend(pos(4) col(1) region(lstyle(none))  linegap(3) size(small) symxsize(*0.2)) title("") replace

*Figure 10
reg ideo payday##c.run##c.run c.age##c.age male i.edu i.occu i.inc i.survey i.month weekholi,cluster(date)
estimate store ideo_7
reg ideo payday##c.run##c.run c.age##c.age male i.edu i.occu i.inc i.survey i.month weekholi if inrange(run,-1,1),cluster(date)
estimate store ideo_1

reg right_att payday##c.run##c.run c.age##c.age male i.edu i.occu i.inc i.survey i.month weekholi,cluster(date)
estimate store rightatt_7
reg right_att payday##c.run##c.run c.age##c.age male i.edu i.occu i.inc i.survey i.month weekholi if inrange(run,-1,1),cluster(date)
estimate store rightatt_1

reg vot_right payday##c.run##c.run c.age##c.age male i.edu i.occu i.inc i.survey i.month weekholi,cluster(date)
estimate store rightvot_7
reg vot_right payday##c.run##c.run c.age##c.age male i.edu i.occu i.inc i.survey i.month weekholi if inrange(run,-1,1),cluster(date)
estimate store rightvot_1

coefplot ideo_7 ideo_1, bylabel("Self-placement") || rightatt_7 rightatt_1, bylabel("Attitudes") || rightvot_7 rightvot_1, bylabel("Vote intention") keep(1.payday) horizontal xline(0, lpattern(dash)) bycoefs byopts(yrescale color(grey)) ylabel(, angle(h)) grid(none) ciopts(recast(rcap) color(black)) xlabel(-.1 "-0.1" -.05 "-0.05" 0 "0" 0.05 "0.05" 0.1 "0.1") p1(label(7 days)) p2(label(1 day)) xtitle("") plotregion(lcolor(white)) mcolor(gs0) scheme(s1mono) graphregion(color(white)) legend(pos(4) col(1) region(lstyle(none))  linegap(3) size(small) symxsize(*0.2)) title("")

***SUPPLEMENTARY MATERIAL***

*Table B.1
foreach var of varlist male occu edu inc ideo_group inc_3 survey month {
tab `var',gen(`var')	
}

eststo sum_stat: estpost sum tax run inc_31 inc_32 inc_33 ideo_group1 ideo_group2 ideo_group3 ideo right_att vot_right male1 male2 male3 age edu1 edu2 edu3 edu4 edu5 edu6 occu1 occu2 occu3 occu4 inc1 inc2 inc3 inc4 inc5 inc6 inc7 inc8 inc9 inc10 inc11 inc12 inc13 inc14 survey1 survey2 survey3 month1 month2 month3 month4 month5 month6 month7 month8 month9 month10 weekholi

esttab sum_stat, cells("count(fmt(0)) mean(fmt(2)) sd(fmt(2)) min(fmt(0)) max(fmt(0))")

drop male1 male2 male3 occu1 occu2 occu3 occu4 edu1 edu2 edu3 edu4 edu5 edu6 inc1 inc2 inc3 inc4 inc5 inc6 inc7 inc8 inc9 inc10 inc11 inc12 inc13 inc14 ideo_group1 ideo_group2 ideo_group3 inc_31 inc_32 inc_33 survey1 survey2 survey3 month1 month2 month3 month4 month5 month6 month7 month8 month9 month10

*Table C.1
*(see Table 1 above)

*Figure D.1
foreach num of numlist 4/7 {
logit tax payday##c.run##c.run if inrange(run,-`num',`num'),cluster(date) 
estimate store sim_`num' 							

logit tax payday##c.run##c.run c.age##c.age male i.edu i.occu i.inc i.survey i.month weekholi if inrange(run,-`num',`num'),cluster(date) 
estimate store full_`num'							
}

foreach num of numlist 1/3 {
logit tax payday##c.run if inrange(run,-`num',`num'),cluster(date) 
estimate store sim_`num' 							

logit tax payday##c.run c.age##c.age male i.edu i.occu i.inc i.survey i.month weekholi if inrange(run,-`num',`num'),cluster(date) 
estimate store full_`num'							
}

coefplot sim_7 full_7, bylabel("7 days") || sim_6 full_6, bylabel("6 days") || sim_5 full_5, bylabel("5 days") || sim_4 full_4, bylabel("4 days") || sim_3 full_3, bylabel("3 days") || sim_2 full_2, bylabel("2 days") || sim_1 full_1, bylabel("1 day") keep(1.payday)  vertical yline(0, lpattern(dash)) bycoefs byopts(yrescale color(grey)) ciopts(recast(rcap) color(black)) ylabel(-0.5 "-0.5" 0 "0" 0.5 "0.5" 1 "1" 1.5 "1.5", angle(h)) p1(label(Simple model)) p2(label(Full model)) plotregion(lcolor(white)) mcolor(gs0) scheme(s1mono) graphregion(color(white)) ytitle(Support for tax cuts, height(6)) xtitle(Bandwidth, height(6)) legend(pos(4) col(1) region(lstyle(none))  linegap(3) size(small) symxsize(*0.2)) title("") 

*Figure E.1
foreach num of numlist 4/7 {
reg tax payday##c.run##c.run if inrange(run,-`num',`num') & occu==1,cluster(date) 
estimate store employ_sim_`num' 							

reg tax payday##c.run##c.run c.age##c.age male i.edu i.inc i.survey i.month weekholi if inrange(run,-`num',`num') & occu==1,cluster(date) 
estimate store employ_full_`num'							
}

foreach num of numlist 1/3 {
reg tax payday##c.run if inrange(run,-`num',`num') & occu==1,cluster(date) 
estimate store employ_sim_`num' 							

reg tax payday##c.run c.age##c.age male i.edu i.inc i.survey i.month weekholi if inrange(run,-`num',`num') & occu==1,cluster(date) 
estimate store employ_full_`num'							
}

coefplot employ_sim_7 employ_full_7, bylabel("7 days") || employ_sim_6 employ_full_6, bylabel("6 days") || employ_sim_5 employ_full_5, bylabel("5 days") || employ_sim_4 employ_full_4, bylabel("4 days") || employ_sim_3 employ_full_3, bylabel("3 days") || employ_sim_2 employ_full_2, bylabel("2 days") || employ_sim_1 employ_full_1, bylabel("1 day") keep(1.payday)  vertical yline(0, lpattern(dash)) bycoefs byopts(yrescale color(grey)) ciopts(recast(rcap) color(black)) ylabel(-0.1 "-0.1" 0 "0" 0.1 "0.1" 0.2 "0.2" 0.3 "0.3" 0.4 "0.4", angle(h)) p1(label(Simple model)) p2(label(Full model)) plotregion(lcolor(white)) mcolor(gs0) scheme(s1mono) graphregion(color(white)) ytitle(Probability of supporting tax cuts, height(6)) xtitle(Bandwidth, height(6)) legend(pos(4) col(1) region(lstyle(none))  linegap(3) size(small) symxsize(*0.2)) title("")

*Table F.1	
foreach num of numlist 0 0.05 0.1 {
rddisttestk run, threshold(0) k(`num')
}

*Figure F.1
foreach var of varlist male edu inc {
recode `var' (99=.),gen(`var'_new)
}

foreach var of varlist male_new occu {
tab `var',gen(`var')	
}

sum age,d
gen age_s=(age-r(mean))/r(sd)	

*7-days bandwidth
logit male_new2 payday run c.run#c.run payday#c.run payday#c.run#c.run,cluster(date)
estimate store male_7						
reg age_s payday run c.run#c.run payday#c.run payday#c.run#c.run,cluster(date)
estimate store age_7							
ologit edu_new payday run c.run#c.run payday#c.run payday#c.run#c.run,cluster(date)
estimate store edu_7							
ologit inc_new payday run c.run#c.run payday#c.run payday#c.run#c.run,cluster(date)
estimate store inc_7
foreach num of numlist 1/4 {
logit occu`num' payday run c.run#c.run payday#c.run payday#c.run#c.run,cluster(date) //significant difference in proportion "Not in the labor force" at cutoff (p = 0.067)
estimate store occu`num'_7
}

*1-day bandwidth
logit male_new2 payday run if inrange(run,-1,1),cluster(date)
estimate store male_1							
reg age_s payday run if inrange(run,-1,1),cluster(date)
estimate store age_1							
ologit edu_new payday run if inrange(run,-1,1),cluster(date)
estimate store edu_1							
ologit inc_new payday run if inrange(run,-1,1),cluster(date)
estimate store inc_1							
foreach num of numlist 1/4 {
logit occu`num' payday run if inrange(run,-1,1),cluster(date)
estimate store occu`num'_1
}

coefplot male_7 male_1, bylabel("Male") || age_7 age_1, bylabel("Age") || edu_7 edu_1, bylabel("Education") || inc_7 inc_1, bylabel("Income") || occu1_7 occu1_1, bylabel("Employed") || occu2_7 occu2_1, bylabel("Unemployed") || occu3_7 occu3_1, bylabel("Student") || occu4_7 occu4_1, bylabel("Not in the labor force") keep(payday)  horizontal xline(0, lpattern(dash)) bycoefs byopts(yrescale color(grey)) ciopts(recast(rcap) color(black)) grid(none) ylabel(, angle(h)) xlabel(-1.5 "-1.5" -1 "-1" -.5 "-0.5" 0 "0" .5 "0.5" 1 "1" 1.5 "1.5") p1(label(7 days)) p2(label(1 day)) plotregion(lcolor(white)) mcolor(gs0) scheme(s1mono) graphregion(color(white)) xtitle("") legend(pos(4) col(1) region(lstyle(none))  linegap(3) size(small) symxsize(*0.2)) title("")

*Table F.2
qui: eststo donut: reg tax payday##c.run##c.run c.age##c.age male i.edu i.occu i.inc i.survey i.month weekholi if run<-1 | run>1,cluster(date) //donut RDD: dropping respondents 1 day before to 1 day after payday
estadd local band "2-7 days", replace
estadd local run "Interactive quadratic", replace

qui: eststo dropcut: reg tax payday##c.run##c.run c.age##c.age male i.edu i.occu i.inc i.survey i.month weekholi if payday_no!= 5 & payday_no!=7,cluster(date) //dropping potentially problematic paydays
estadd local band "7 days", replace							
estadd local run "Interactive quadratic", replace							
eststo dnes01: reg tax payday##c.run##c.run c.age##c.age male i.edu i.occu i.inc i.month weekholi if survey==1,cluster(date) //using only DNES 2001/2002
estadd local band "7 days", replace							
estadd local run "Interactive quadratic", replace	

esttab donut dropcut dnes01, cells("b(fmt(2))" se(par(`"("' `")"') fmt(2)) p(par(`"["' `"]"') fmt(3))) stats(band run N, fmt(%9.0fc) label("Bandwidth" "Running variable" "Observations")) mtitle("Donut RDD" "Excl. payday 5 and 7" "DNES 01/02") nonumbers keep(1.payday) indicate(Covariates=age) modelwidth(25) label

*Figure G.1
*7-days bandwidth
foreach num of numlist 1/4 {
reg tax payday c.run##c.run payday#c.run payday#c.run#c.run c.age##c.age male i.edu i.inc i.survey i.month weekholi if occu==`num',cluster(date)
estimate store occu`num'_7	
}
	
*test of significant differences in effect
foreach num of numlist 1/4 {
qui: reg tax payday c.run##c.run payday#c.run payday#c.run#c.run c.age##c.age male i.edu i.inc i.survey i.month weekholi if occu==`num'
estimate store occu`num'_7_test							
}							

qui: suest occu1_7_test occu2_7_test occu3_7_test occu4_7_test,cluster(date)
test [occu1_7_test_mean]payday=[occu2_7_test_mean]payday //comparing employed and unemployed
return list
test [occu1_7_test_mean]payday=[occu3_7_test_mean]payday //comparing employed and students
return list
test [occu1_7_test_mean]payday=[occu4_7_test_mean]payday //comparing employed and not in the labor force
return list
test [occu2_7_test_mean]payday=[occu3_7_test_mean]payday //comparing unemployed and students
return list
test [occu2_7_test_mean]payday=[occu4_7_test_mean]payday //comparing unemployed and not in the labor force
return list
test [occu3_7_test_mean]payday=[occu4_7_test_mean]payday //comparing students and not in the labor force
return list	
	
test [occu1_7_test_mean]payday=[occu2_7_test_mean]payday=[occu3_7_test_mean]payday=[occu4_7_test_mean]payday //joint test of equal effect
return list
	
*1-day bandwidth
foreach num of numlist 1/4 {
reg tax payday run c.age##c.age male i.edu i.inc i.survey i.month weekholi if inrange(run,-1,1) & occu==`num',cluster(date)
estimate store occu`num'_1
}
	
*test of significant differences in effect
foreach num of numlist 1/4 {
qui: reg tax payday run c.age##c.age male i.edu i.inc i.survey i.month weekholi if inrange(run,-1,1) & occu==`num'
estimate store occu`num'_1_test
}
							
qui: suest occu1_1_test occu2_1_test occu3_1_test occu4_1_test,cluster(date)
test [occu1_1_test_mean]payday=[occu2_1_test_mean]payday //comparing employed and unemployed
return list
test [occu1_1_test_mean]payday=[occu3_1_test_mean]payday //comparing employed and students
return list
test [occu1_1_test_mean]payday=[occu4_1_test_mean]payday //comparing employed and not in the labor force
return list
test [occu2_1_test_mean]payday=[occu3_1_test_mean]payday //comparing unemployed and students
return list
test [occu2_1_test_mean]payday=[occu4_1_test_mean]payday //comparing unemployed and not in the labor force
return list
test [occu3_1_test_mean]payday=[occu4_1_test_mean]payday //comparing students and not in the labor force
return list	
	
test [occu1_1_test_mean]payday=[occu2_1_test_mean]payday=[occu3_1_test_mean]payday=[occu4_1_test_mean]payday //joint test of equal effect
return list

coefplot occu1_7 occu2_7 occu3_7 occu4_7, bylabel("7 days") || occu1_1 occu2_1 occu3_1 occu4_1, bylabel("1 day") keep(payday)  vertical yline(0, lpattern(dash)) ciopts(recast(rcap) color(black)) bycoefs byopts(yrescale color(grey)) ylabel(-1 "-1" -.5 "-0.5" 0 "0" .5 "0.5" 1 "1", angle(h)) p1(label(Employed)) p2(label(Unemployed)) p3(label(Student)) p4(label(Not in the labor force)) plotregion(lcolor(white)) mcolor(gs0) scheme(s1mono) graphregion(color(white)) ytitle(Probability of supporting tax cuts,height(6)) xtitle(Bandwidth, height(6)) legend(pos(4) col(1) region(lstyle(none))  linegap(3) size(small) symxsize(*0.2)) title("")

*Figure H.1
foreach num of numlist 1/13 {
reg tax payday c.run##c.run payday#c.run payday#c.run#c.run c.age##c.age male i.edu i.occu i.survey i.month weekholi if inc==`num',cluster(date)
estimate store inc_`num'							
}

coefplot inc_1, bylabel("<100k") || inc_2, bylabel("100-150k") || inc_3, bylabel("150-200k") || inc_4, bylabel("200-250k") ||inc_5, bylabel("250-300k") || inc_6, bylabel("300-350k") || inc_7, bylabel("350-400k") || inc_8, bylabel("400-450k") || inc_9, bylabel("450-500k") || inc_10, bylabel("500-600k") || inc_11, bylabel("600-700k") || inc_12, bylabel("700-800k") || inc_13, bylabel("+800k") keep(payday) ciopts(recast(rcap) color(black)) grid(none) ytick(., notick) ylabel(, angle(h)) xline(0, lpattern(dash)) bycoefs byopts(yrescale color(grey)) xlabel(-.5 "-0.5" 0 "0" .5 "0.5" 1 "1" 1.5 "1.5") ytitle(Income (DKK),height(6)) plotregion(lcolor(white)) mcolor(gs0) scheme(s1mono) graphregion(color(white)) xtitle(Probability of supporting tax cuts, height(6)) legend(off) title("")